package cn.echoedu.specifics;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import cn.echoedu.daoconstants.TableName;
import cn.echoedu.entity.AppApi;
import cn.echoedu.util.L;

public class SpecAppApi extends BaseSpec{
    private final String T="SpecAppApi-------->";
	@Override
	public <T> PreparedStatement getPreparedInsert(Connection con,
			TableName tableName, T currentPojo) throws SQLException {
		// TODO Auto-generated method stub
		L.gpi(T);
		AppApi appapi=(AppApi)currentPojo;
		String sql="insert into appapi values(?,?)";
		L.p(T+sql);
		PreparedStatement ps=con.prepareStatement(sql);
		ps.setInt(1,appapi.getAppapiid());
		ps.setString(2,appapi.getAppkey());
		return ps;
	}

	@Override
	public <T> PreparedStatement getPreparedInsertRunning(Connection con,
			TableName tableName, T currentPojo) throws SQLException {
		// TODO Auto-generated method stub
		L.gpir(T);
		AppApi appapi=(AppApi)currentPojo;
		String sql="insert into appapi (appkey) values(?)";
		L.p(T+sql);
		PreparedStatement ps=con.prepareStatement(sql);
	    ps.setString(1,appapi.getAppkey());
		return ps;
	}

	@Override
	public Object getPojo(ResultSet rs) throws SQLException {
		// TODO Auto-generated method stub
		L.gp(T);
		AppApi appapi=new AppApi();
		appapi.setAppapiid(rs.getInt(1));
		appapi.setAppkey(rs.getString(2));
		return rs;
	}

	@Override
	public <T> PreparedStatement getPreparedUpdate(Connection con,
			TableName tableName, T oldPojo, T currentPojo) throws SQLException {
		// TODO Auto-generated method stub
		L.gpu(T);
		AppApi newappapi=(AppApi)currentPojo;
		AppApi oldappapi=(AppApi)oldPojo;
		String sql="update appapi set appkey=? where appapiid=?";
	     L.p(T+sql);
		PreparedStatement ps=con.prepareStatement(sql);
		return null;
	}

	@Override
	public Object getLeftJoinPojo(ResultSet rs) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object getPojoBySql(ResultSet rs) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public <T> String getPreparedInsertGetPrimaryKeySql(Connection con,
			TableName tableName, T currentPojo) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public <T> PreparedStatement getPreparedListInsert(Connection con,
			TableName tableName, T currentPojo) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public <T> PreparedStatement getPreparedListInsertRunning(Connection con,
			TableName tableName, T currentPojo) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

}
